# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=littleblackbox
pkgver=0.1.3
pkgrel=3
pkgdesc='Penetration testing tool, search in a collection of thousands of private SSL keys extracted from various embedded devices.'
arch=('x86_64' 'aarch64')
groups=('blackarch' 'blackarch-scanner' 'blackarch-fuzzer' 'blackarch-crypto')
url='http://code.google.com/p/littleblackbox/wiki/FAQ'
license=('MIT')
depends=('openssl' 'libpcap' 'sqlite' 'curl')
makedepends=('tar')
source=("http://littleblackbox.googlecode.com/files/$pkgname-$pkgver.tar.gz")
sha512sums=('b9e1c0090a2b67b6425bc680cd11e7ce0a7beb32')

prepare() {
  cd "$pkgname-$pkgver"

  sed -i '/#include <curl\/types.h>/d' src/dbupdate.c
}

build() {
  cd "$pkgname-$pkgver"

  rm -f bin/littleblackbox 2>/dev/null

  cd src

  make distclean

  ./configure --prefix=/usr

  make
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/share/doc/$pkgname"

  install -Dm 755 bin/littleblackbox "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 bin/lbb.db "$pkgdir/usr/share/$pkgname/lbb.db"
  install -Dm 644 docs/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" \
    docs/{FAQ,README,submission.txt} \

  ln -s /usr/share/littleblackbox/lbb.db "$pkgdir/usr/bin/lbb.db"
}

